
package main

import (
	"fmt"
	"reflect"
)

func main(){
	printReflectInfo()
}

func printReflectInfo(){
	var i int=23
	var f float32=5.532
	var s string="hello golang"
	var u user=user{name:"jack",age:23,sex:"male"}
	var ii []int=[]int{1,2,3,4}
	var ie interface{}=&ii
	
	fmt.Println("")
	fmt.Println("type int -> ",reflect.TypeOf(i))
	fmt.Println("type float -> ",reflect.TypeOf(f))
	fmt.Println("type string -> ",reflect.TypeOf(s))
	fmt.Println("type struct -> ",reflect.TypeOf(u))
	fmt.Println("type array[int] -> ",reflect.TypeOf(ii))
	fmt.Println("type interface - > ",reflect.TypeOf(ie))
	fmt.Println("type reflect -> ",reflect.TypeOf(reflect.TypeOf(u)))
	
	fmt.Println("")
	fmt.Println("value int -> ",reflect.ValueOf(i))
	fmt.Println("value float -> ",reflect.ValueOf(f))
	fmt.Println("value string -> ",reflect.ValueOf(s))
	fmt.Println("value struct -> ",reflect.ValueOf(u))
	fmt.Println("value array[int] -> ",reflect.ValueOf(ii))
	fmt.Println("value interface - > ",reflect.ValueOf(ie))
	fmt.Println("value reflect -> ",reflect.ValueOf(reflect.ValueOf(u)))

}

type user struct{
	name string
	age int
	sex string
}